package exp.parser;

import grammar.parser.FuncFParams;
import word.parser.WordElement;

public class IntConstExp extends UnaryExp {
    private final int value;

    public IntConstExp(int value) {
        super(true, true);
        this.value = value;
    }

    public static IntConstExp buildIntConstExp() {
        assert getAnalyzingWord().getType() == WordElement.WordType.INTCON;
        int value = Integer.parseInt(getAnalyzingWord().getWord());
        analyzeNextWord();
        return new IntConstExp(value);
    }

    @Override
    public LVal toLVal() {
        return null;
    }

    @Override
    public Integer compute() {
        return value;
    }

    @Override
    public FuncFParams.FuncFParam checkDimension() {
        return new FuncFParams.FuncFParam();
    }
}
